<?php
//模拟登陆用户和密码
$name="admin";
$password= 123456;
//我们给YES加密，对将来开发有用处
$yes= sha1(md5("yes"));
//判断登陆


	if($_POST['username'] == $name && $_POST['password'] == $password){
	    echo $username = $_POST['username'];
		setcookie ("nav",$yes,time()+3600);
		setcookie ("username",$username,time()+3600);
        header ( 'Location: admin.php' );
	}else{
		echo '用户名或密码不正确！';
	}
	
    if($_GET['login']=="out"){
	  setcookie ("nav",'',time()-3600);
	  setcookie ("username",'',time()-3600);
	  header ( 'Location: index.php' );

	}	
	
?>
